package com.itheima.homework04;

import java.util.Random;

public class Test03 {
    public static void main(String[] args) {
        //创建一个长度为6的整数数组
        int[] arr = new int[6];
        Random r = new Random();
        //随机生成六个0（包含）-100（不包含）之间的整数存放到数组中
        for (int i = 0; i < arr.length; i++) {
            arr[i] = r.nextInt(100);
        }
        //计算出数组中所有元素的和并打印
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        System.out.println(sum);
    }
}
